/**
 * WhiMAIcpp - C++ interface for the Whiskey Media API's.
 *  Copyright (C) 2010  Anders Bugge
 *
 *  Data created and powered by:
 *  Whiskey Media	http://www.whiskeymedia.com/
 *  Giant Bomb		http://www.giantbomb.com/
 *  Comic Vine		http://www.comicvine.com/
 */

#ifndef DETAIL_H_
#define DETAIL_H_

#include "parser.h"

// FD
namespace json
{
	class UnknownElement;
}

namespace WM
{

class DetailBase: public Parser
{
public:
	void update( unsigned int id, bool* ok = 0 );

	double asValue( std::string item, bool* ok = 0 );
	std::string asString( std::string item, bool* ok = 0 );
	Array* asArray( std::string item, bool* ok = 0 );

protected:
	DetailBase( std::string name, std::string site, std::string key );
	DetailBase( std::string name, std::string site, std::string key, unsigned int id, bool* ok );
	virtual ~DetailBase();

	std::string URL_EXTRA;

private:
	const json::UnknownElement& getElement( std::string item, bool* ok );

	std::string type;
	std::map<std::string, Array*> arrays;
	std::string URL_START;
	std::string apikey;
};

namespace GB
{

class Detail: public DetailBase
{
public:
	Detail( std::string name );
	Detail( std::string name, unsigned int id, bool* ok = 0 );
	virtual ~Detail(){;}
};

}

namespace CV
{

class Detail: public DetailBase
{
public:
	Detail( std::string name );
	Detail( std::string name, unsigned int id, bool* ok = 0 );
	virtual ~Detail(){;}
};

}

}

#endif /* DETAIL_H_ */
